<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>支付宝沙箱测试</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            max-width: 800px;
            margin: 0 auto;
            padding: 20px;
            text-align: center;
        }
        .form-group {
            margin-bottom: 15px;
        }
        label {
            display: block;
            margin-bottom: 5px;
        }
        input, button {
            padding: 8px;
            font-size: 16px;
        }
        button {
            background-color: #1677ff;
            color: white;
            border: none;
            cursor: pointer;
            border-radius: 4px;
        }
    </style>
</head>
<body>
    <h1>支付宝沙箱支付测试</h1>
    <form id="payForm">
        <div class="form-group">
            <label for="amount">金额（元）:</label>
            <input type="number" id="amount" name="amount" value="0.01" step="0.01" min="0.01">
        </div>
        <div class="form-group">
            <label for="subject">商品名称:</label>
            <input type="text" id="subject" name="subject" value="测试商品">
        </div>
        <button type="submit">立即支付</button>
    </form>

    <script>
        document.getElementById('payForm').addEventListener('submit', function(e) {
            e.preventDefault();
            const amount = document.getElementById('amount').value;
            const subject = document.getElementById('subject').value;

            window.location.href = `/api/pay/create?amount=${amount}&subject=${encodeURIComponent(subject)}`;
        });
    </script>
</body>
</html>
